package com.calendarpicker;

import android.os.Bundle;

import com.github.gzuliyujiang.calendarpicker.CalendarPicker;
import com.github.gzuliyujiang.calendarpicker.OnSingleDatePickListener;
import com.github.gzuliyujiang.calendarpicker.core.ColorScheme;
import com.myatest.R;

import java.util.Date;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

/**
 * User: psn
 * Date: 2021/11/3
 */
public class CalendarpickerActivity extends AppCompatActivity {
    private long singleTimeInMillis;
    @Override
    protected void onCreate(@Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.act_calendar);
        findViewById(R.id.show_sel_calendar).setOnClickListener(v -> {
            CalendarPicker picker = new CalendarPicker(this);
            picker.setRangeDateOnFuture(3);
            if (singleTimeInMillis == 0) {
                singleTimeInMillis = System.currentTimeMillis();
            }
            picker.setSelectedDate(singleTimeInMillis);
            picker.setColorScheme(new ColorScheme()
                    .daySelectBackgroundColor(0xFF0000FF)
                    .dayStressTextColor(0xFF0000DD));
            picker. setIntervalNotes("","22222");
            picker.setOnSingleDatePickListener(new OnSingleDatePickListener() {
                @Override
                public void onSingleDatePicked(@NonNull Date date) {
                    singleTimeInMillis = date.getTime();
                }
            });
            picker.show();
        });


    }
}
